<?php
class ControllerCommonFooter extends Controller
{
	public function index()
	{
		$this->getList();
		$this->id="footer";
		$this->template="common/footer.tpl";
		$this->render();
	}
	
	function getList()
	{
		$this->load->model("core/sitemap");
		$siteid = $this->user->getSiteId();
			
		$rootid = $this->model_core_sitemap->getRoot($this->document->sitemapid, $siteid);

		
		$str = "";
		
		
		$sitemaps = $this->model_core_sitemap->getListByParent($parentid, $siteid);
		$this->data['menus'];
		foreach($sitemaps as $item)
		{
			//$childs = $this->model_core_sitemap->getListByParent($item['sitemapid'], $siteid);
			
			$currenttab = "";
			if($item['sitemapid'] == $rootid) $currenttab = "class='current-tab'";
			
			$link = "<a ".$currenttab.">".$item['sitemapname']."</a>";
			if($item['moduleid'] != "group" && $item['moduleid'] != "homepage"){
				$link = "<a ".$currenttab." href='index.php?route=page/detail&sitemapid=".$item['sitemapid']."'>".$item['sitemapname']."</a>";
			}elseif($item['moduleid'] == "homepage"){
				$link = "<a ".$currenttab." href='?'>".$item['sitemapname']."</a>";
			}
			$this->data['menus'][] = $link;
			/*$str .= "<li>";
			$str .= $link;
			
			if(count($childs) > 0)
			{
				$str .= "<ul>";
				$str .= $this->getMenu($item['sitemapid']);
				$str .= "</ul>";
			}

			$str .= "</li>";*/
		}
		
		//return $str;
	}
}
?>